package Logica;

import Datatypes.DataPuntaje;
import Fabricas.Factory;
import Interfaces.IWeb;
import javax.xml.ws.Endpoint;

public class Publicador {

    private Endpoint endpoint = null;
    private IWeb servicio = null;
    
    public void publicar(String direccionServicio) throws Exception{
        
        Factory f = Factory.getInstance(System.getProperty("user.dir") + "/Data/Persistencia/Base de Datos/SCDBase.sqlite");
        
        try{
        
            IWeb iw = f.getIWeb();
            servicio = iw;
            endpoint = Endpoint.create(iw);
            endpoint.publish(direccionServicio);
            
        }
        
        catch(Exception e){
            
            throw e;
                
        }
        
    }
    
    public void detenerPublicacion(){
    
        if(endpoint != null){
            
            endpoint.stop();
    
        }
            
    }
    
    public IWeb getServicio(){
    
        return servicio;
    
    }
    
}
